package com.hz.handler;

import com.hz.pojo.Purchase;
import com.hz.service.PurchaseService;
import com.hz.utils.ResultData;
import com.hz.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/purchase")
public class PurchaseC {
    @Autowired
    private PurchaseService service;


    @GetMapping("/list")
    public ResultData info() {
        List<Purchase> res = service.getList();
        if (res != null) {
            return ResultUtils.sucuss("success", res);
        } else {
            return ResultUtils.error("没有数据", null);
        }
    }
}
